import { EntitySchema } from '@mikro-orm/core';

export class TypechoChat {
  id!: number;
  chatid?: string;
  uid?: number = 0;
  toid?: number = 0;
  created?: number = 0;
  lastTime?: number = 0;
  type?: number = 0;
  name?: string;
  pic?: string;
  ban?: number = 0;
}

export const TypechoChatSchema = new EntitySchema({
  class: TypechoChat,
  properties: {
    id: { primary: true, type: 'number' },
    chatid: { type: 'string', length: 255, nullable: true },
    uid: { type: 'number', nullable: true, default: 0 },
    toid: { type: 'number', nullable: true, default: 0 },
    created: { type: 'number', nullable: true, default: 0 },
    lastTime: { type: 'number', fieldName: 'lastTime', nullable: true, default: 0 },
    type: { type: 'number', nullable: true, default: 0 },
    name: { type: 'string', length: 400, nullable: true },
    pic: { type: 'string', length: 400, nullable: true },
    ban: { type: 'number', nullable: true, default: 0 },
  },
});
